try:
    # pydantic v2
    from pydantic_settings import BaseSettings
except ImportError:
    # pydantic v1
    from pydantic import BaseSettings
from pathlib import Path

class Settings(BaseSettings):
    API_V1_STR: str = "/api/v1"
    PROJECT_NAME: str = "垃圾邮件分类API"
    
    # 路径配置
    BASE_DIR: Path = Path(__file__).resolve().parent.parent.parent
    DATA_DIR: Path = BASE_DIR / "data"
    MODEL_DIR: Path = BASE_DIR / "models"
    
    # 模型配置
    PRETRAINED_MODEL_NAME: str = "bert-base-uncased"
    MAX_LENGTH: int = 128
    BATCH_SIZE: int = 32
    
    # 服务配置
    HOST: str = "0.0.0.0"
    PORT: int = 8000
    
    class Config:
        case_sensitive = True

settings = Settings() 